home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Crossword
/
Source
/
BackjumpState.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
970b
|
67 lines
/*
File BackjumpState.m
This state is used for backjumping search. The state can keep track of a single nogood.
*/
#import <appkit/appkit.h>
#import "Backjump.h"
/* ———————————————————————————————————————————————————————————————————————————— */
@implementation BackjumpState
- squareClass { return [BackjumpSquare class]; }
- wordClass { return [BackjumpWord class]; }
- (BOOL) inNogood { return nogood; }
/* ———————————————————————————————————————————————————————————————————————————— */
- initPuzzle: (id) thePuzzle
{
[super initPuzzle: thePuzzle];
nogoodWords = [[List alloc] init];
nogood = NO;
return self;
}
- free
{
[nogoodWords free];
return [super free];
}
- mustChange: (id) word
{
[word mark];
[nogoodWords addObject: word];
nogood = YES;
return self;
}
- isok
{
if (nogood)
{
[nogoodWords makeObjectsPerform: @selector(clear)];
[nogoodWords empty];
nogood = NO;
}
return self;
}
@end